#include <catch2/catch.hpp>

#include <string>

#include "solution.hpp"
#include "036_valid_sudoku/solution.hpp"

TEST_CASE("37. Sudoku Solver", "[037]") {
    std::vector< std::vector<char> > board{
            {'5','3','.','.','7','.','.','.','.'},
            {'6','.','.','1','9','5','.','.','.'},
            {'.','9','8','.','.','.','.','6','.'},
            {'8','.','.','.','6','.','.','.','3'},
            {'4','.','.','8','.','3','.','.','1'},
            {'7','.','.','.','2','.','.','.','6'},
            {'.','6','.','.','.','.','2','8','.'},
            {'.','.','.','4','1','9','.','.','5'},
            {'.','.','.','.','8','.','.','7','9'} };
    solution_037::Solution().solveSudoku(board);
    std::string board_string;
    board_string.reserve(90);
    for (auto& row : board) {
        board_string.push_back('\n');
        board_string += std::string(row.cbegin(), row.cend());
    }
    CAPTURE(board_string);
    CHECK(solution_036::Solution().isValidSudoku(board));
}
